package com.zf.spring.microservice.zuul.common.filters;

import java.util.List;
import java.util.Map;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;

@Component
@ConfigurationProperties("gateway.filter")
public class FilterConfigurationBean {
	private List<String> noAuthenticationUrls;
	private Map<String, String> errorMessage;

	public List<String> getNoAuthenticationUrls() {
		return noAuthenticationUrls;
	}

	public void setNoAuthenticationUrls(List<String> noAuthenticationUrls) {
		this.noAuthenticationUrls = noAuthenticationUrls;
	}

	public Map<String, String> getErrorMessage() {
		return errorMessage;
	}

	public void setErrorMessage(Map<String, String> errorMessage) {
		this.errorMessage = errorMessage;
	}

	public String getMessageByErrorStatus(String status) {
		if (StringUtils.isEmpty(status)) {
			return this.errorMessage.get("999");
		}
		return this.errorMessage.get(status);
	}

}
